package com.example.higo.model;

import com.example.higo.model.impl.homepage.HomePageModelImp;
import com.example.higo.model.impl.maishou.MaishouModelImp;
import com.example.higo.model.impl.shishangquan.ShishangquanModelImp;

/**
 * Created by wj on 2016/11/6.
 */
public class ModelFactory {
    private static volatile ModelFactory instance = null;

    private static IHomePageModel iHomePageModel = null;
    private static IShishangquanModel iShishangquanModel = null;
    private static IMaishouModel iMaishouModel = null;

    private ModelFactory() {
    }

    public static ModelFactory getInstance() {
        if (instance == null) {
            synchronized (ModelFactory.class) {
                if (instance == null) {
                    instance = new ModelFactory();
                }
            }
        }
        return instance;
    }

    /**
     *   HomePage
     */
    public static IHomePageModel getIHomePageModel(){
        if (iHomePageModel ==null){
                iHomePageModel = new HomePageModelImp();
        }
        return iHomePageModel;
    }


    /**
     *  shishangquan
     */

    public static IShishangquanModel getIShishangquanModel(){
        if (iShishangquanModel ==null){
            iShishangquanModel = new ShishangquanModelImp();
        }
        return iShishangquanModel;
    }


    /**
     *  maishou
     */

    public static IMaishouModel getIMaishouModel(){
        if (iMaishouModel ==null){
            iMaishouModel = new MaishouModelImp();
        }
        return iMaishouModel;
    }

}
